package org.bonorsoft.modules.MobileDingding.controller;

import org.bonorsoft.common.util.TokenUtils;
import org.bonorsoft.modules.education.entity.Manage;
import org.bonorsoft.modules.education.entity.Resources;
import org.bonorsoft.modules.education.service.IManageService;
import org.bonorsoft.modules.education.service.IResourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 *主页跳转
 */
@Controller
public class MobileCenterController {
    @Autowired
    private IResourcesService resourcesService;
    @Autowired
    private IManageService manageService;

    //办公中心
    @GetMapping("/mobile/officeCenter")
    public String mobileOfficeCenter(ModelMap mmap, HttpServletRequest request)
    {
        String token = TokenUtils.getTokenByRequest(request);
        mmap.put("token", token);
        return "mobile/mobileEdu/office/officeCenter";
    }

    //资源中心
    @GetMapping("/mobile/resourceCenter")
    public String mobileResourceCenter(ModelMap mmap, HttpServletRequest request)
    {
        String token = TokenUtils.getTokenByRequest(request);
        mmap.put("token", token);
        List<Resources> resources = resourcesService.list();
        List<Manage> manages = manageService.list();
        mmap.put("resources",resources);
        mmap.put("manages",manages);
        return "mobile/mobileEdu/resources/resourceCenter";
    }
}
